﻿#region Copyright

// // The contents of this file are subject to the Mozilla Public License
// // Version 1.1 (the "License"); you may not use this file except in compliance
// // with the License. You may obtain a copy of the License at
// //   
// // http://www.mozilla.org/MPL/
// //   
// // Software distributed under the License is distributed on an "AS IS"
// // basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
// // License for the specific language governing rights and limitations under 
// // the License.
// //   
// // The Initial Developer of the Original Code is Robert Smyth.
// // Portions created by Robert Smyth are Copyright (C) 2008-2013.
// //   
// // All Rights Reserved.

#endregion

using System;
using System.ComponentModel;
using System.Timers;


namespace NoeticTools.NWorkflow.DotNetInterop
{
    public class Timer : ITimer
    {
        private readonly System.Timers.Timer _inner;

        public Timer(System.Timers.Timer inner)
        {
            _inner = inner;
        }

        public void Dispose()
        {
            _inner.Dispose();
        }

        public event EventHandler Disposed
        {
            add { _inner.Disposed += value; }
            remove { _inner.Disposed -= value; }
        }

        public void BeginInit()
        {
            _inner.BeginInit();
        }

        public void Close()
        {
            _inner.Close();
        }

        public void EndInit()
        {
            _inner.EndInit();
        }

        public void Start()
        {
            _inner.Start();
        }

        public void Stop()
        {
            _inner.Stop();
        }

        public bool AutoReset
        {
            get { return _inner.AutoReset; }
            set { _inner.AutoReset = value; }
        }

        public bool Enabled
        {
            get { return _inner.Enabled; }
            set { _inner.Enabled = value; }
        }

        public double Interval
        {
            get { return _inner.Interval; }
            set { _inner.Interval = value; }
        }

        public ISynchronizeInvoke SynchronizingObject
        {
            get { return _inner.SynchronizingObject; }
            set { _inner.SynchronizingObject = value; }
        }

        public event ElapsedEventHandler Elapsed
        {
            add { _inner.Elapsed += value; }
            remove { _inner.Elapsed -= value; }
        }
    }
}